/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Karyawan;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author yolan
 */
public class karyawantabelmodel extends AbstractTableModel{
    private ArrayList<Karyawan> k = new ArrayList<Karyawan>();

    public karyawantabelmodel(List<Karyawan> k) {
        this.k = (ArrayList<Karyawan>) k;
    }

    @Override
    public int getRowCount() {
        return k.size();
    }

    @Override
    public int getColumnCount() {
        return 4;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Karyawan kategori = k.get(rowIndex);
        
        switch (columnIndex) {
            case 0:
                return kategori.getNIP();
            case 1:
                return kategori.getNama();
            case 2:
                return kategori.getJumlahhadir();
            
            default:
                return " ";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "NIP ";
            case 1:
                return "Nama ";
            case 2:
                return "Daftar Hadir ";
            
            default:
                return " ";
        }
    }
}
